/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* 顶部导航栏 */
.header {
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #667eea;
    font-size: 28px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: #f5f5f5;
    border-radius: 20px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #4CAF50;
}

.status-dot.disconnected {
    background: #f44336;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 配置面板 */
.config-panel {
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.config-panel h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 20px;
}

.config-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* 主内容区域 */
.main-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.card-header h3 {
    color: #333;
    font-size: 18px;
}

.card-body {
    text-align: center;
}

/* 数据显示 */
.metric-display {
    margin: 20px 0;
}

.metric-value {
    font-size: 48px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.metric-status {
    font-size: 16px;
    color: #666;
    padding: 5px 15px;
    border-radius: 20px;
    display: inline-block;
}

.metric-status.normal {
    background: #e8f5e9;
    color: #4CAF50;
}

.metric-status.high {
    background: #ffebee;
    color: #f44336;
}

.metric-status.low {
    background: #e3f2fd;
    color: #2196F3;
}

.threshold-info {
    color: #999;
    font-size: 14px;
    margin-top: 10px;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    background: #f0f0f0;
    color: #666;
}

.btn-sm:hover {
    background: #e0e0e0;
}

.btn-feeding {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #FFA726, #FF6F00);
    color: white;
    font-size: 18px;
    margin-top: 15px;
}

.btn-feeding:hover {
    background: linear-gradient(135deg, #FF9800, #E65100);
}

.btn-light {
    width: 100%;
    padding: 15px;
    background: #6c757d;
    color: white;
    font-size: 18px;
    margin-top: 15px;
    transition: all 0.3s;
}

.btn-light:hover {
    background: #5a6268;
}

/* 日志面板 */
.log-panel {
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.log-panel h3 {
    color: #333;
    margin-bottom: 15px;
}

.log-content {
    background: #1e1e1e;
    color: #00ff00;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    height: 200px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.log-content::-webkit-scrollbar {
    width: 8px;
}

.log-content::-webkit-scrollbar-track {
    background: #2a2a2a;
}

.log-content::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.log-entry {
    margin-bottom: 5px;
    line-height: 1.5;
}

.log-entry.info {
    color: #00ff00;
}

.log-entry.success {
    color: #4CAF50;
}

.log-entry.error {
    color: #f44336;
}

.log-entry.warning {
    color: #FFA726;
}

/* 页面导航 */
.page-nav {
    background: white;
    padding: 15px 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 12px 24px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    color: #666;
    font-weight: 500;
}

.nav-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
}

.nav-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
}

/* 页面内容 */
.page-content {
    animation: fadeIn 0.3s ease-out;
}

/* 图表容器 */
.chart-container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    flex-wrap: wrap;
    gap: 15px;
}

.chart-header h2 {
    color: #333;
    font-size: 24px;
    margin: 0;
}

.chart-info {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #666;
}

.chart-info strong {
    color: #667eea;
}

canvas {
    max-width: 100%;
    height: 400px !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .config-form {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .page-nav {
        justify-content: center;
    }
    
    .nav-btn {
        flex: 1;
        min-width: 100px;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .chart-info {
        flex-direction: column;
        gap: 5px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

/* 加载状态 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

